package bravo.xc.com.xc_bravo_android.base;

import android.content.Context;

import java.util.ArrayList;
import java.util.List;

import rx.Subscription;
import rx.subscriptions.CompositeSubscription;

/**
 * CREATED BY YANK
 * DATE : 2017/10/21
 * MAIL : YANK.TENYOND@GMAIL.COM
 * FUNCTION :
 */

public abstract class BasePresenter <V> {

    public Context context;
    public V view;
    public CompositeSubscription compositeSubscription = new CompositeSubscription();

    /**
     * Bind View
     */
    public void onBinded(V view){
        this.view = view;
    }

    /**
     * Unbind View
     */
    public void onDetached(){
        this.view = null;
        if( compositeSubscription!= null&&!compositeSubscription.isUnsubscribed()){
                compositeSubscription.unsubscribe();
        }
    }

}
